/*
 * MouseEventImp.cpp
 *
 *  Created on: Apr 18, 2009
 *      Author: wrice
 */

#include "DOMEventImp.h"
namespace DOMEventImp {


const DOMString MouseEventImp::EVENT_CLICK = "click";
const DOMString MouseEventImp::EVENT_MOUSE_DOWN = "mousedown";
const DOMString MouseEventImp::EVENT_MOUSE_UP = "mouseup";
const DOMString MouseEventImp::EVENT_MOUSE_OVER = "mouseover";
const DOMString MouseEventImp::EVENT_MOUSE_MOVE = "mousemove";
const DOMString MouseEventImp::EVENT_MOUSE_OUT = "mouseout";
const DOMString MouseEventImp::EVENT_DBL_CLICK = "dblclick";


MouseEventImp::MouseEventImp(
		EventTarget * target,
		EventTarget * currentTarget,
		DOMString typeArg,
		bool canBubbleArg,
		bool cancelableArg,
		AbstractView * viewArg, long detailArg,
		long screenXArg, long screenYArg,
		long clientXArg, long clientYArg,
		bool ctrlKeyArg, bool altKeyArg,
		bool shiftKeyArg, bool metaKeyArg,
		unsigned short buttonArg,
		EventTarget * relatedTargetArg)
: UIEventImp(target, currentTarget, typeArg, canBubbleArg, cancelableArg, viewArg, detailArg)
{
	initMouseEvent(typeArg, canBubbleArg, cancelableArg, viewArg, detailArg, screenXArg, screenYArg, clientXArg
			, clientYArg, ctrlKeyArg, altKeyArg, shiftKeyArg, metaKeyArg, buttonArg, relatedTargetArg);
}

void MouseEventImp::initMouseEvent(
	DOMString typeArg,
	bool canBubbleArg,
	bool cancelableArg,
	AbstractView * viewArg,
	long detailArg, long screenXArg, long screenYArg,
	long clientXArg, long clientYArg, bool ctrlKeyArg,
	bool altKeyArg, bool shiftKeyArg,
	bool metaKeyArg, unsigned short buttonArg,
	EventTarget * relatedTargetArg)
{
	initUIEvent(typeArg, canBubbleArg, cancelableArg, viewArg, detailArg);
	screenX_ = screenXArg;
	screenY_ = screenYArg;
	clientX_ = clientXArg;
	clientY_ = clientYArg;
	ctrlKey_ = ctrlKeyArg;
	altKey_ = altKeyArg;
	shiftKey_ = shiftKeyArg;
	metaKey_ = metaKeyArg;
	button_ = buttonArg;
	relatedTarget_ = relatedTargetArg;
}

long MouseEventImp::getScreenX() const {
	return screenX_;
}
long MouseEventImp::getScreenY() const {
	return screenY_;
}
long MouseEventImp::getClientX() const {
	return clientX_;
}
long MouseEventImp::getClientY() const {
	return clientY_;
}
bool MouseEventImp::getCtrlKey() const {
	return ctrlKey_;
}
bool MouseEventImp::getShiftKey() const {
	return shiftKey_;
}
bool MouseEventImp::getAltKey() const {
	return altKey_;
}
bool MouseEventImp::getMetaKey() const {
	return metaKey_;
}
unsigned short MouseEventImp::getButton() const {
	return button_;
}
EventTarget * MouseEventImp::getRelatedTarget() const {
	return relatedTarget_;
}

}
